package com.kuang.Dao;

import com.kuang.pojo.Department;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
@Repository
public class DepartmentDao {

    public static Object getDepartments;
    private static Map<Integer, Department> departmentMap = null;
    static {
        departmentMap = new HashMap<Integer, Department>();
        departmentMap.put(101, new Department(101, "aaa"));
        departmentMap.put(102, new Department(102, "bbb"));
        departmentMap.put(103, new Department(103, "ccc"));
        departmentMap.put(104, new Department(104, "ddd"));
        departmentMap.put(105, new Department(105, "eee"));

    }
    @Autowired
    public static Collection<Department> getDepartments() {
        return departmentMap.values();
    }

    public Department getDepartmentById(Integer id) {
        return departmentMap.get(id);


    }




}
